
#pragma once

#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>

#include <iostream>

using namespace cv;

namespace course_03_resize
{

    //缩放大小
    void resize(std::string imgPath)
    {
        Mat image = imread(imgPath);
        Mat imgResize;
        std::cout << image.size << std::endl;
        resize(image, imgResize, Size(604, 557));
        resize(image, imgResize, Size(), 0.5, 0.5);

        imshow("IMAGE", image);
        imshow("IMAGE-Resize", imgResize);

        waitKey(0);
    }

    //裁剪
    void crop(std::string imgPath)
    {
        Mat image = imread(imgPath);
        Mat imgCrop;

        Rect roi(100, 100, 300, 250);
        imgCrop = image(roi);

        imshow("IMAGE", image);
        imshow("IMAGE-imgCrop", imgCrop);

        waitKey(0);
    }

}